package org.example.transaction_springboot_demo.service.impl;

import io.seata.spring.annotation.GlobalTransactional;
import org.example.transaction_springboot_demo.mapper.d1.D1User;
import org.example.transaction_springboot_demo.mapper.d2.D2User;
import org.example.transaction_springboot_demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    D1User d1User;

    @Autowired
    D2User d2User;
    @GlobalTransactional
    @Override
    public void transfer() {
        d1User.updateUser(110, 1);
        d2User.updateUser(190, 1);

        int i = 1 / 0;
    }
}
